package co.fitstart.entity.market;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import co.fitstart.entity.user.User;

@Entity
@Table(name = "market_achievement")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class MarketAchievement {
    
    @Id
    @GeneratedValue
    private Long id;
    
    /** 成就类型 */
    private AchievementType type;
    
    /** 成就状态 */
    private AchievementStatus status;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private User user;
    
    /**
     * 
     */
    public MarketAchievement() {
        
    }
    
    /**
     * 
     * @param type
     * @param status
     */
    public MarketAchievement(AchievementType type, AchievementStatus status, User user) {
        this.type = type;
        this.status = status;
        this.user = user;
    }
    
    /**
     * 
     * @param status
     * @return
     */
    public MarketAchievement changeStatus(AchievementStatus status) {
        this.status = status;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the type
     */
    public AchievementType getType() {
        return type;
    }

    /**
     * @return the status
     */
    public AchievementStatus getStatus() {
        return status;
    }

    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param type the type to set
     */
    public void setType(AchievementType type) {
        this.type = type;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(AchievementStatus status) {
        this.status = status;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }

}
